﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GroupShare.aspx.cs" Inherits="OrganizedIN.UI.GroupShare" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function SetParentHeight() {
            // This function resizes an IFrame object
            // to fit its content.
            // The IFrame tag must have a unique ID attribute.
            var body = document.body,html = document.documentElement;
            var height = Math.max(body.scrollHeight, body.offsetHeight,html.clientHeight, html.scrollHeight, html.offsetHeight);
            parent.document.getElementById("popupframe").height = height;
        }
    </script>

</head>
<body onload="SetParentHeight();">
    <form id="form1" runat="server">
    <link href="<%=ResolveClientUrl("~/CSS/internal_stylesheet.css") %>" rel="stylesheet"
        type="text/css" />
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div id="middle_tab_main">
                <div class="middle_tab_content">
                    <div id="middle_tab" style="margin-left: 20px">
                        <div id="middle_tab_title" align="center">
                            Share With Group</div>
                        <div class="middle_tab_content">
                            <center>
                                <asp:Label ID="lblSuccess" runat="server" Text="Your content has been shared successfully !"
                                    Font-Names="BatangChe" ForeColor="Green" Style="font-weight: 700" Visible="False"></asp:Label>
                                <table style="width: 95%;" runat="server" id="content">
                                    <tr>
                                        <td align="left" valign="top" style="width: 20%; vertical-align: top">
                                            <div style="display: inline">
                                                <asp:Image ID="imgUser" runat="server" Height="60px" Width="50px" />
                                                <asp:LinkButton ID="lnkUser" runat="server" Style="font-weight: 700; vertical-align: top"></asp:LinkButton>
                                            </div>
                                        </td>
                                        <td align="left" valign="top" width="100px">
                                            <b>Comment </b>
                                        </td>
                                        <td align="left" valign="top" width="500px">
                                            <asp:TextBox ID="txtComment" runat="server" Rows="4" TextMode="MultiLine" Width="80%"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvGMeassage" runat="server" ControlToValidate="txtComment"
                                                Display="Dynamic" ErrorMessage="*" ValidationGroup="GShare"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left" valign="top" width="110px">
                                            &nbsp;
                                        </td>
                                        <td align="left" valign="top" width="100px">
                                            <b>Select Group </b>
                                        </td>
                                        <td align="left" valign="top" width="500px">
                                            <asp:DropDownList ID="ddlGroup" runat="server" DataSourceID="dsGroups" DataTextField="Group_Name"
                                                DataValueField="Group_ID">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvGroupname" runat="server" ControlToValidate="ddlGroup"
                                                Display="Dynamic" ErrorMessage="* Select Group" InitialValue="- Select -" ValidationGroup="GShare"></asp:RequiredFieldValidator>
                                            <asp:SqlDataSource ID="dsGroups" runat="server" ConnectionString="<%$ ConnectionStrings:OrganizedInConnectionString %>"
                                                SelectCommand="SELECT     0 AS Group_ID, '- Select -' AS Group_Name, 0 AS SortOrder
UNION
SELECT     Group_Master.Group_ID, Group_Master.Group_Name, 1 AS SortOrder
FROM         Group_Master INNER JOIN
                      User_Organizer_Mapping ON Group_Master.Organizer_User_MappingID = User_Organizer_Mapping.Organizer_User_MappingID
WHERE     (User_Organizer_Mapping.username = @Uname)
UNION
SELECT     Group_Contact_Mappin.Group_ID, Group_Master_1.Group_Name, 1 AS SortOrder
FROM         Group_Contact_Mappin INNER JOIN
                      Group_Master AS Group_Master_1 ON Group_Contact_Mappin.Group_ID = Group_Master_1.Group_ID INNER JOIN
                      User_Organizer_Mapping AS User_Organizer_Mapping_1 ON 
                      Group_Master_1.Organizer_User_MappingID = User_Organizer_Mapping_1.Organizer_User_MappingID
WHERE     (Group_Contact_Mappin.Approved = 1) AND (User_Organizer_Mapping_1.username = @Uname)
ORDER BY SortOrder, Group_Name">
                                                <SelectParameters>
                                                    <asp:SessionParameter Name="Uname" SessionField="UserID" />
                                                </SelectParameters>
                                            </asp:SqlDataSource>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left" valign="top" width="110px">
                                            <asp:HiddenField ID="hdnUsername" runat="server" />
                                        </td>
                                        <td align="left" valign="top" width="100px">
                                            &nbsp;
                                        </td>
                                        <td align="left" valign="top" width="500px">
                                            <asp:Button ID="btnShare" runat="server" Text="Share" ValidationGroup="GShare" OnClick="btnShare_Click" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left" valign="top" width="110px">
                                            &nbsp;
                                        </td>
                                        <td align="left" valign="top" width="100px">
                                            &nbsp;
                                        </td>
                                        <td align="left" valign="top" width="500px">
                                            <asp:Literal ID="ltrlDetails" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                </table>
                                <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="4000" OnTick="Timer1_Tick">
                                </asp:Timer>
                            </center>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnShare" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    </form>
</body>
</html>
